import request from '@/utils/request'

export default {
  //添加或更新课程信息
  addOrUpdateCourseInfo(courseInfo){
    return request({
      url:"/eduservice/course/addCourseInfo",
      method:"POST",
      data: courseInfo
    })
  },
  //发布课程
  publishCourse(courseId){
    return request({
      url:`/eduservice/course/publishCourse/${courseId}`,
      method:"POST"
    })
  },//修改课程状态
  updateCourseStatus(courseId,status){
    return request({
      url:`/eduservice/course/updateCourseStatus/${courseId}`,
      method:"POST",
      params: {
        status:status
      }
    })
  },
  //分页条件查询课程
  getCourseList(current, size, query) {
    if (!(typeof (current) == "number"))
      current = 1
    if (!(typeof (size) == "number"))
      size = 10
    return request({
      url: "/eduservice/course/pageConditionCourse/" + current + "/" + size,
      method: 'get',
      params:query
    })
  },
  //删除
  delCourse(id){
    return request({
      url: "/eduservice/course/" + id ,
      method: 'delete'
    })
  },
  //查询一个课程
  getOne(id){
    return request({
      url: "/eduservice/course/getCourseInfo/" + id ,
      method: 'get',

    })
  },

}

